//
//  UIView+HMExtension.m
//  02-UIView分类
//
//  Created by heima on 16/3/5.
//  Copyright © 2016年 刘春牢. All rights reserved.
//

#import "UIView+VIZExtension.h"

@implementation UIView (VIZExtension)

- (void)setX:(CGFloat)x {
    
    // 1.取出frame
    CGRect frame = self.frame;
    
    // 2.改x值
    frame.origin.x = x;
    
    // 3.赋值
    self.frame = frame;

}

- (CGFloat)x {
    
    return self.frame.origin.x;

}

- (void)setY:(CGFloat)y {
    
    // 1.取出frame
    CGRect frame = self.frame;
    
    // 2.改x值
    frame.origin.y = y;
    
    // 3.赋值
    self.frame = frame;
}

- (CGFloat)y {
    
    return self.frame.origin.y;
}

- (void)setWidth:(CGFloat)width {
    
    // 1.取出frame
    CGRect frame = self.frame;
    
    // 2.改width值
    frame.size.width = width;
    
    // 3.赋值
    self.frame = frame;

}

- (CGFloat)width {
    return self.frame.size.width;
}

- (void)setHeight:(CGFloat)height {

    // 1.取出frame
    CGRect frame = self.frame;
    
    // 2.改height
    frame.size.height = height;
    
    // 3.赋值
    self.frame = frame;

}

- (CGFloat)height {

    return self.frame.size.height;
    
}


//随机颜色
+ (UIColor *) randomColor{
    
    float r = arc4random()%256/255.0;
    float g = arc4random()%256/255.0;
    float b = arc4random()%256/255.0;
    return [UIColor colorWithRed:r green:g blue:b alpha:1];
    
}



@end
